import { defineStore } from 'pinia';

type SettingStores = {
  lovingState: boolean | string;
  pageTitle: string;
};
export const useSettingStores = defineStore('settingStores', {
  state: (): SettingStores => ({
    lovingState: JSON.parse(localStorage.getItem('lovingState')) ?? true,
    pageTitle: localStorage.getItem('pageTitle') ?? '浪浪助手 LOVE 香香公主'
  }),
  getters: {},
  actions: {
    changePageTitle(data: string) {
      console.log('daaa', data);
      this.pageTitle = data;
      localStorage.setItem('pageTitle', this.pageTitle);
    },
    changeLovingState(state: boolean) {
      this.lovingState = state;
      localStorage.setItem('lovingState', this.lovingState);
    }
  }
});
